﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CMPPCore.Message
{
    /// <summary>
    /// 系统消息
    /// </summary>
    public class SystemMessage
    {
        public object Message { get; private set; }

        public bool HasError
        {
            get
            {
                return Message is Exception;
            }
        }

        public SystemMessage(string msg)
        {
            Message = msg;
        }

        public SystemMessage(Exception ex)
        {
            Message = ex;
        }

        public override string ToString()
        {
            if (HasError)
            {
                return (Message as Exception).Message;
            }
            else
            {
                return Message.ToString();
            }
        }

    }
}
